//package com.timo.rabbitmq.controller;
//
//import com.timo.rabbitmq.model.Book;
//import org.springframework.amqp.core.FanoutExchange;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
///**
// * @Description: 类用途：
// * @Author: Timo
// * @Date: 2019/7/19 11:19
// */
//@RestController
//@RequestMapping(value = "/books")
//public class BookController {
//
//    private final RabbitTemplate rabbitTemplate;
//
//    @Autowired
//    private FanoutExchange fanoutExchange;
//
//    @Autowired
//    public BookController(RabbitTemplate rabbitTemplate) {
//        this.rabbitTemplate = rabbitTemplate;
//    }
//
//    /**
//     * this.rabbitTemplate.convertAndSend(RabbitConfig.DEFAULT_BOOK_QUEUE, book); 对应 {@link BookHandler#listenerAutoAck}
//     * this.rabbitTemplate.convertAndSend(RabbitConfig.MANUAL_BOOK_QUEUE, book); 对应 {@link BookHandler#listenerManualAck}
//     */
//    @GetMapping
//    public void defaultMessage() {
//        Book book = new Book();
//        book.setId("1");
//        book.setName("一起来学Spring Boot");
//        this.rabbitTemplate.convertAndSend(RabbitConfig.DEFAULT_BOOK_QUEUE, book);
//        this.rabbitTemplate.convertAndSend(RabbitConfig.MANUAL_BOOK_QUEUE, book);
//    }
//
//
//    @GetMapping("/hello")
//    public void hello() {
//        this.rabbitTemplate.convertAndSend(fanoutExchange.getName(),"","哈哈");
//    }
//
//
//    @GetMapping("/timo")
//    public void timo() {
//        this.rabbitTemplate.convertAndSend("timo-fanout","","timo");
//    }
//
//
//}
